#include "example_nodes.h"

ExampleNode1:: ExampleNode1(QMenu *contextMenu, QGraphicsItem *parent , QGraphicsScene *scene ) : ExampleBaseNode(contextMenu, parent, scene) {
    /*
        QLabel* in0 = new QLabel("in0");
        this->innerGridLayout->addWidget(in0);

        //dialog->setAttribute(Qt::WA_DeleteOnClose);
        //this->setWidget(dialog);

        addConnector(new NodeConnector(this, scene, in0, NodeConnector::In, NodeConnector::Left, true));
        */
    //FIXME:
    addConnectorAndLabel("in0", NodeConnector::In, NodeConnector::Left);
}

ExampleNode2::ExampleNode2(QMenu *contextMenu, QGraphicsItem *parent , QGraphicsScene *scene  ) : ExampleBaseNode(contextMenu, parent, scene) {
    /*
        QLabel* in0 = new QLabel("in0");

        innerGridLayout->addWidget(in0);

        //QGroupBox *dialog = new QGroupBox();
        //dialog->setLayout(layout);

        //dw668 was active: dialog->setAttribute(Qt::WA_DeleteOnClose);

        //this->setWidget(dialog);

        addConnector(new NodeConnector(this, scene, in0, NodeConnector::In, NodeConnector::Left, false));
        */
    //FIXME:
    addConnectorAndLabel("in0", NodeConnector::In, NodeConnector::Left);
}
ExampleNode5::ExampleNode5(QMenu *contextMenu, QGraphicsItem *parent  , QGraphicsScene *scene ) : ExampleBaseNode(contextMenu, parent, scene) {
    //QFormLayout *layout2 = new QFormLayout;
    /*
        QLabel* out0 = new QLabel("out0");
        out0->setAlignment(Qt::AlignRight);
        QLabel* in0 = new QLabel("in0");

        innerGridLayout->addWidget(in0,0,0);
        innerGridLayout->addWidget(out0,0,1);
        QLabel* in1 = new QLabel("in1");
        innerGridLayout->addWidget(in1,1,0,1,2);
        QLabel* in2 = new QLabel("in2");
        innerGridLayout->addWidget(in2,2,0,1,2);
        QLabel* inout0 = new QLabel("inOut0");
        inout0->setAlignment(Qt::AlignRight);
        innerGridLayout->addWidget(inout0,3,0,1,2);

        QSpinBox* spinBox = new QSpinBox();
        spinBox->setMinimum(0);
        spinBox->setMaximum(9);
        innerGridLayout->addWidget(spinBox,4,0,1,2);
        */

    addConnectorAndLabel("in0", NodeConnector::In, NodeConnector::Left);
    addConnectorAndLabel("out0", NodeConnector::Out, NodeConnector::Right);
    addConnectorAndLabel("in1", NodeConnector::In, NodeConnector::Left);
    addConnectorAndLabel("in2", NodeConnector::In, NodeConnector::Left);
    addConnectorAndLabel("inOut0", NodeConnector::InOut, NodeConnector::Right);
    QSpinBox* spinBox = new QSpinBox();
    spinBox->setMinimum(0);
    spinBox->setMaximum(9);
    leftLayout->addWidget(spinBox);
    addConnector(new NodeConnector(this, scene, spinBox, NodeConnector::InOut));


    //QDialog *dialog1 = new QDialog();
    //dw from: http://lists.trolltech.com/qt-interest/2002-05/thread00837-0.html
    //MyDialog::MyDialog(QWidget* parent, const char* name)	: QDialog(parent, name, true, WStyle_Customize | WStyle_DialogBorder | WStyle_Title | WStyle_SysMenu)

    /*
        QDialog *dialog1 = new QDialog(NULL, Qt::WindowType::FramelessWindowHint);
        dialog1->setLayout(layout2);
        */

    //dialog1->setAttribute(Qt::WA_DeleteOnClose);

    //dw new3
    //dialog1->setStyle(new QStyle::());

    //dialog1->setSizeGripEnabled(false);

    //dialog1->setFixedSize(dialog1->size());
    //dialog1->setSizePolicy(QSizePolicy::Fixed);
    //layout2->setSizeConstraint(QLayout::SetFixedSize);

    //dialog1->layout()->setSizeConstraint( QLayout::SetFixedSize ) ;
    //dialog1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);


    /*
        this->setWidget(dialog1);
        setWindowFlags(dialog1->windowFlags() | Qt::Tool);
        */
    /*
        addConnector(new NodeConnector(this, scene, out0, NodeConnector::Out, NodeConnector::Right));
        addConnector(new NodeConnector(this, scene, in0, NodeConnector::In));
        addConnector(new NodeConnector(this, scene, in1, NodeConnector::In));
        addConnector(new NodeConnector(this, scene, in2, NodeConnector::In));
        addConnector(new NodeConnector(this, scene, inout0, NodeConnector::InOut, NodeConnector::Right));
        addConnector(new NodeConnector(this, scene, spinBox, NodeConnector::InOut));
        */
}


ExampleNode6::ExampleNode6(QMenu *contextMenu, QGraphicsItem *parent  , QGraphicsScene *scene ) : ExampleBaseNode(contextMenu, parent, scene) {

    addConnectorAndLabel("inout0", NodeConnector::InOut, NodeConnector::Left);
    addConnectorAndLabel("inout1", NodeConnector::InOut, NodeConnector::Right);

    /*
        //QFormLayout *layout = new QFormLayout;
        QLabel* inout0 = new QLabel("inout0");
        QLabel* inout1 = new QLabel("inout1");
        inout1->setAlignment(Qt::AlignRight);
        //layout->addRow(inout0, inout1);
        //QGroupBox *dialog = new QGroupBox();
        //dialog->setLayout(layout);

        innerGridLayout->addWidget(inout0,0,0);
        innerGridLayout->addWidget(inout1,0,1);
        */

    /*
        dialog->setAttribute(Qt::WA_DeleteOnClose);
        this->setWidget(dialog);
        //dw with Qt:Tool they seem to be movable by click!!! but bar has same size on windows vista
        setWindowFlags(dialog->windowFlags() | Qt::Tool | Qt::WindowType::FramelessWindowHint);
        */

    /*
        addConnector(new NodeConnector(this, scene, inout0, NodeConnector::InOut, NodeConnector::Left, false));
        addConnector(new NodeConnector(this, scene, inout1, NodeConnector::InOut, NodeConnector::Right, false));
        */
}

ExampleNode7::ExampleNode7(QMenu *contextMenu, QGraphicsItem *parent , QGraphicsScene *scene  ) : ExampleBaseNode(contextMenu, parent, scene, Qt::WindowType::Dialog | Qt::CustomizeWindowHint | Qt::WindowType::MSWindowsFixedSizeDialogHint | Qt::WindowType::WindowTitleHint | Qt::Tool) {
    addConnectorAndLabel("out0", NodeConnector::Out, NodeConnector::Right);

    /*
        //QFormLayout *layout = new QFormLayout;
        QLabel* out0 = new QLabel("out0");
        out0->setAlignment(Qt::AlignRight);
        */
    /*
        layout->addRow(out0);
        QDialog *dialog = new QDialog(NULL);
        dialog->setWindowTitle("ExampleNode7: frame with title, 1 x out, multi connection");
        //QToolBox *dialog = new QToolBox();
        dialog->setWindowTitle("xxx7");
        dialog->setLayout(layout);
        //dialog->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        //dialog->setFixedSize(dialog->sizeHint());
        //layout->setSizeConstraint(QLayout::SetFixedSize);
        this->mNoResize = false;
        */

    //dialog->setAttribute(Qt::WA_DeleteOnClose);
    //this->setWidget(dialog);

    /*
        innerGridLayout->addWidget(out0);
        addConnector(new NodeConnector(this, scene, out0, NodeConnector::Out, NodeConnector::Right, false));
        */
}

ExampleNode8::ExampleNode8(QMenu *contextMenu, QGraphicsItem *parent  , QGraphicsScene *scene ) : ExampleBaseNode(contextMenu, parent, scene) {

    // addConnectorAndLabel("t0", NodeConnector::InOut, NodeConnector::Top);
    // addConnectorAndLabel("t1", NodeConnector::InOut, NodeConnector::Top);
    // addConnectorAndLabel("t2", NodeConnector::InOut, NodeConnector::Top);

    // addConnectorAndLabel("l0", NodeConnector::InOut, NodeConnector::Left);
    // addConnectorAndLabel("l1", NodeConnector::InOut, NodeConnector::Left);
    // addConnectorAndLabel("l2", NodeConnector::InOut, NodeConnector::Left);

    // addConnectorAndLabel("r0", NodeConnector::InOut, NodeConnector::Right);
    // addConnectorAndLabel("r1", NodeConnector::InOut, NodeConnector::Right);
    // addConnectorAndLabel("r2", NodeConnector::InOut, NodeConnector::Right);

    // addConnectorAndLabel("b0", NodeConnector::InOut, NodeConnector::Bottom);
    // addConnectorAndLabel("b1", NodeConnector::InOut, NodeConnector::Bottom);
    // addConnectorAndLabel("b2", NodeConnector::InOut, NodeConnector::Bottom);



}
